/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.crm.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.M250;
import queenb.net.entitybean.N850;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class M250Store extends M250 {

    public List<M250> getComboboxM250(int pnFH000, int pnFH200, int pnFN850, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMBO_M250, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN850),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, M250.class);
        } catch (SQLException ex) {
            Logger.getLogger(M250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(M250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(M250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public int updateM250(int pnPM250, int pnFH000, int pnFH200, int pnFN850, String pvMV251, String pvMV252, String pvMV253, String pvMV254, String pvMV255, String pvLOGIN) {
        try {
            DataStatement dateStatement = new DataStatement(PackageContants.UPDATE_M250, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPM250),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN850),
                        new Param(OracleTypes.CHAR, pvMV251),
                        new Param(OracleTypes.CHAR, pvMV252),
                        new Param(OracleTypes.CHAR, pvMV253),
                        new Param(OracleTypes.CHAR, pvMV254),
                        new Param(OracleTypes.CHAR, pvMV255),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            Param[] p = dateStatement.getMapParam();
            return super.update(dateStatement, M250.class);
        } catch (SQLException ex) {
            System.err.println("Error from updateM250: " + ex.getMessage());
            return 0;
        }

    }

    public List<M250> getListM250(int pnFH000, int pnFH200, int pnFN850, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_M250, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN850),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, M250.class);
        } catch (SQLException ex) {
            Logger.getLogger(M250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(M250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(M250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public int deleteM250(int pnFH000, int pnFH200, int pnPM250, String pvLOGIN) {
        try {
            DataStatement dateStatement = new DataStatement(PackageContants.DELETE_M250, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnPM250),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            Param[] p = dateStatement.getMapParam();
            return super.update(dateStatement, M250.class);
        } catch (SQLException ex) {
            System.err.println("Error from deleteM250: " + ex.getMessage());
            return 0;
        }
    }
}
